package huiwenshu;

public class HuiWenTest {
    public static void main(String[] args) {
        //定义字符串
        String str = "12321";
        System.out.println(justiceHuiWen(str));
//        //Stringbuilder接受
//        StringBuilder sb1 = new StringBuilder(str);
//        if(str.equals(sb1)){
//            System.out.println(true);
//        }else{
//            System.out.println(false);
//        }
    }

    //定义方法
    public static boolean justiceHuiWen(String str){
        //定义字符串
        String newStr="";
       //将字符传反向遍历
        for (int i = str.length()-1; i >=0; i--) {
            //重组字符串
            char c = str.charAt(i);
            //转成字符串
            String s = Character.toString(c);
            newStr+=s;
        }
        if(str.equals(newStr)){
            return true;
        }

        return false;
    }
}
